<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="收款单号" prop="receiptOrderNo">
        <el-input
          v-model="queryParams.receiptOrderNo"
          placeholder="请输入收款单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商户ID" prop="businessId">
        <el-input
          v-model="queryParams.businessId"
          placeholder="请输入商户ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同ID" prop="contractId">
        <el-input
          v-model="queryParams.contractId"
          placeholder="请输入合同ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同编号" prop="contractNo">
        <el-input
          v-model="queryParams.contractNo"
          placeholder="请输入合同编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="解约协议ID" prop="tTerminationId">-->
<!--        <el-input-->
<!--          v-model="queryParams.tTerminationId"-->
<!--          placeholder="请输入解约协议ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="楼盘ID" prop="premiseId">-->
<!--        <el-input-->
<!--          v-model="queryParams.premiseId"-->
<!--          placeholder="请输入楼盘ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="小区(使用楼盘名)" prop="premiseName">-->
<!--        <el-input-->
<!--          v-model="queryParams.premiseName"-->
<!--          placeholder="请输入小区(使用楼盘名)"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="房源ID" prop="roomId">-->
<!--        <el-input-->
<!--          v-model="queryParams.roomId"-->
<!--          placeholder="请输入房源ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="房源编号" prop="roomCode">-->
<!--        <el-input-->
<!--          v-model="queryParams.roomCode"-->
<!--          placeholder="请输入房源编号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="承租房间(使用房源名称)" prop="roomName">-->
<!--        <el-input-->
<!--          v-model="queryParams.roomName"-->
<!--          placeholder="请输入承租房间(使用房源名称)"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="业主ID" prop="ownerId">-->
<!--        <el-input-->
<!--          v-model="queryParams.ownerId"-->
<!--          placeholder="请输入业主ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="业主姓名" prop="ownerName">-->
<!--        <el-input-->
<!--          v-model="queryParams.ownerName"-->
<!--          placeholder="请输入业主姓名"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="租客ID" prop="tenantId">-->
<!--        <el-input-->
<!--          v-model="queryParams.tenantId"-->
<!--          placeholder="请输入租客ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="租客姓名(面向业主收款时，为空)" prop="tenantName">-->
<!--        <el-input-->
<!--          v-model="queryParams.tenantName"-->
<!--          placeholder="请输入租客姓名(面向业主收款时，为空)"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="其它款项,款项为其它的时候，输入" prop="otherItemName">-->
<!--        <el-input-->
<!--          v-model="queryParams.otherItemName"-->
<!--          placeholder="请输入其它款项,款项为其它的时候，输入"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="支付金额" prop="paymentAmount">-->
<!--        <el-input-->
<!--          v-model="queryParams.paymentAmount"-->
<!--          placeholder="请输入支付金额"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="实收金额" prop="realPaymentAmount">-->
<!--        <el-input-->
<!--          v-model="queryParams.realPaymentAmount"-->
<!--          placeholder="请输入实收金额"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="选择账期" prop="withReceiptPlanId">-->
<!--        <el-input-->
<!--          v-model="queryParams.withReceiptPlanId"-->
<!--          placeholder="请输入选择账期"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="账期开始日" prop="paymentDaysBegin">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.paymentDaysBegin"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择账期开始日">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="账期截止日" prop="paymentDaysEnd">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.paymentDaysEnd"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择账期截止日">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预定收款日期" prop="collectionDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.collectionDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择预定收款日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="实际收款日期" prop="realCollectionDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.realCollectionDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择实际收款日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="第几期" prop="receiptNumber">-->
<!--        <el-input-->
<!--          v-model="queryParams.receiptNumber"-->
<!--          placeholder="请输入第几期"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="线下支付方式" prop="payMethod">-->
<!--        <el-input-->
<!--          v-model="queryParams.payMethod"-->
<!--          placeholder="请输入线下支付方式"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="其它支付方式-->
<!--,支付方式为其它的时候，输入" prop="otherPayMethod">-->
<!--        <el-input-->
<!--          v-model="queryParams.otherPayMethod"-->
<!--          placeholder="请输入其它支付方式-->
<!--,支付方式为其它的时候，输入"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="支付流水号" prop="payFlowNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.payFlowNo"-->
<!--          placeholder="请输入支付流水号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="账期房租金额" prop="rentalPrice">-->
<!--        <el-input-->
<!--          v-model="queryParams.rentalPrice"-->
<!--          placeholder="请输入账期房租金额"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="税费" prop="tax">-->
<!--        <el-input-->
<!--          v-model="queryParams.tax"-->
<!--          placeholder="请输入税费"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="操作人" prop="operationUser">-->
<!--        <el-input-->
<!--          v-model="queryParams.operationUser"-->
<!--          placeholder="请输入操作人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预留字段1" prop="reserve1">-->
<!--        <el-input-->
<!--          v-model="queryParams.reserve1"-->
<!--          placeholder="请输入预留字段1"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预留字段2" prop="reserve2">-->
<!--        <el-input-->
<!--          v-model="queryParams.reserve2"-->
<!--          placeholder="请输入预留字段2"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预留字段3" prop="reserve3">-->
<!--        <el-input-->
<!--          v-model="queryParams.reserve3"-->
<!--          placeholder="请输入预留字段3"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预留字段4" prop="reserve4">-->
<!--        <el-input-->
<!--          v-model="queryParams.reserve4"-->
<!--          placeholder="请输入预留字段4"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预留字段5" prop="reserve5">-->
<!--        <el-input-->
<!--          v-model="queryParams.reserve5"-->
<!--          placeholder="请输入预留字段5"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="删除标识-->
<!--,0:未删除，1：删除" prop="delFlg">-->
<!--        <el-input-->
<!--          v-model="queryParams.delFlg"-->
<!--          placeholder="请输入删除标识-->
<!--,0:未删除，1：删除"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="创建用户ID" prop="createUserid">-->
<!--        <el-input-->
<!--          v-model="queryParams.createUserid"-->
<!--          placeholder="请输入创建用户ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="更新用户ID" prop="updateUserid">-->
<!--        <el-input-->
<!--          v-model="queryParams.updateUserid"-->
<!--          placeholder="请输入更新用户ID"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['plans:plan:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['plans:plan:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['plans:plan:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['plans:plan:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键" align="center" prop="id" />
      <el-table-column label="收款单号" align="center" prop="receiptOrderNo" />
      <el-table-column label="商户ID" align="center" prop="businessId" />
      <el-table-column label="合同ID" align="center" prop="contractId" />
      <el-table-column label="合同编号" align="center" prop="contractNo" />
      <el-table-column label="合同类型" align="center" prop="contractType" />
<!--      <el-table-column label="解约协议ID" align="center" prop="tTerminationId" />-->
      <el-table-column label="楼盘ID" align="center" prop="premiseId" />
      <el-table-column label="小区(使用楼盘名)" align="center" prop="premiseName" />
      <el-table-column label="房源ID" align="center" prop="roomId" />
      <el-table-column label="房源编号" align="center" prop="roomCode" />
      <el-table-column label="承租房间(使用房源名称)" align="center" prop="roomName" />
<!--      <el-table-column label="业主ID" align="center" prop="ownerId" />-->
<!--      <el-table-column label="业主姓名" align="center" prop="ownerName" />-->
      <el-table-column label="租客ID" align="center" prop="tenantId" />
      <el-table-column label="租客姓名(面向业主收款时，为空)" align="center" prop="tenantName" />
<!--      <el-table-column label="收款类型,1:房租收款 2：租务收款 3：解约结算收款 4：续约结算收款" align="center" prop="receiptType" />-->
<!--      <el-table-column label="收款状态1:未收款 2：已收款 3：已中止  4：已冻结" align="center" prop="skStatus" />-->
      <el-table-column label="账单类型" align="center" prop="billType" />
      <el-table-column label="款项" align="center" prop="itemType" />
<!--      <el-table-column label="其它款项,款项为其它的时候，输入" align="center" prop="otherItemName" />-->
      <el-table-column label="支付金额" align="center" prop="paymentAmount" />
<!--      <el-table-column label="实收金额" align="center" prop="realPaymentAmount" />-->
<!--      <el-table-column label="选择账期" align="center" prop="withReceiptPlanId" />-->
      <el-table-column label="账期开始日" align="center" prop="paymentDaysBegin" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.paymentDaysBegin, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="账期截止日" align="center" prop="paymentDaysEnd" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.paymentDaysEnd, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column label="预定收款日期" align="center" prop="collectionDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.collectionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="实际收款日期" align="center" prop="realCollectionDate" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.realCollectionDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column label="第几期" align="center" prop="receiptNumber" />
      <el-table-column label="线下支付方式" align="center" prop="payMethod" />
<!--      <el-table-column label="其它支付方式,支付方式为其它的时候，输入" align="center" prop="otherPayMethod" />-->
<!--      <el-table-column label="支付流水号" align="center" prop="payFlowNo" />-->
<!--      <el-table-column label="账期房租金额" align="center" prop="rentalPrice" />-->
      <el-table-column label="税费" align="center" prop="tax" />
<!--      <el-table-column label="操作人" align="center" prop="operationUser" />-->
<!--      <el-table-column label="备注" align="center" prop="remark" />-->
<!--      <el-table-column label="预留字段1" align="center" prop="reserve1" />-->
<!--      <el-table-column label="预留字段2" align="center" prop="reserve2" />-->
<!--      <el-table-column label="预留字段3" align="center" prop="reserve3" />-->
<!--      <el-table-column label="预留字段4" align="center" prop="reserve4" />-->
<!--      <el-table-column label="预留字段5" align="center" prop="reserve5" />-->
<!--      <el-table-column label="删除标识,0:未删除，1：删除" align="center" prop="delFlg" />-->
<!--      <el-table-column label="创建用户ID" align="center" prop="createUserid" />-->
<!--      <el-table-column label="更新用户ID" align="center" prop="updateUserid" />-->
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['plans:plan:edit']"-->
<!--          >修改</el-button>-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['plans:plan:remove']"-->
<!--          >删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改收款计划对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="收款单号" prop="receiptOrderNo">
          <el-input v-model="form.receiptOrderNo" placeholder="请输入收款单号" />
        </el-form-item>
        <el-form-item label="商户ID" prop="businessId">
          <el-input v-model="form.businessId" placeholder="请输入商户ID" />
        </el-form-item>
        <el-form-item label="合同ID" prop="contractId">
          <el-input v-model="form.contractId" placeholder="请输入合同ID" />
        </el-form-item>
        <el-form-item label="合同编号" prop="contractNo">
          <el-input v-model="form.contractNo" placeholder="请输入合同编号" />
        </el-form-item>
        <el-form-item label="解约协议ID" prop="tTerminationId">
          <el-input v-model="form.tTerminationId" placeholder="请输入解约协议ID" />
        </el-form-item>
        <el-form-item label="楼盘ID" prop="premiseId">
          <el-input v-model="form.premiseId" placeholder="请输入楼盘ID" />
        </el-form-item>
        <el-form-item label="小区(使用楼盘名)" prop="premiseName">
          <el-input v-model="form.premiseName" placeholder="请输入小区(使用楼盘名)" />
        </el-form-item>
        <el-form-item label="房源ID" prop="roomId">
          <el-input v-model="form.roomId" placeholder="请输入房源ID" />
        </el-form-item>
        <el-form-item label="房源编号" prop="roomCode">
          <el-input v-model="form.roomCode" placeholder="请输入房源编号" />
        </el-form-item>
        <el-form-item label="承租房间(使用房源名称)" prop="roomName">
          <el-input v-model="form.roomName" placeholder="请输入承租房间(使用房源名称)" />
        </el-form-item>
        <el-form-item label="业主ID" prop="ownerId">
          <el-input v-model="form.ownerId" placeholder="请输入业主ID" />
        </el-form-item>
        <el-form-item label="业主姓名" prop="ownerName">
          <el-input v-model="form.ownerName" placeholder="请输入业主姓名" />
        </el-form-item>
        <el-form-item label="租客ID" prop="tenantId">
          <el-input v-model="form.tenantId" placeholder="请输入租客ID" />
        </el-form-item>
        <el-form-item label="租客姓名(面向业主收款时，为空)" prop="tenantName">
          <el-input v-model="form.tenantName" placeholder="请输入租客姓名(面向业主收款时，为空)" />
        </el-form-item>
        <el-form-item label="其它款项,款项为其它的时候，输入" prop="otherItemName">
          <el-input v-model="form.otherItemName" placeholder="请输入其它款项,款项为其它的时候，输入" />
        </el-form-item>
        <el-form-item label="支付金额" prop="paymentAmount">
          <el-input v-model="form.paymentAmount" placeholder="请输入支付金额" />
        </el-form-item>
        <el-form-item label="实收金额" prop="realPaymentAmount">
          <el-input v-model="form.realPaymentAmount" placeholder="请输入实收金额" />
        </el-form-item>
        <el-form-item label="选择账期" prop="withReceiptPlanId">
          <el-input v-model="form.withReceiptPlanId" placeholder="请输入选择账期" />
        </el-form-item>
        <el-form-item label="账期开始日" prop="paymentDaysBegin">
          <el-date-picker clearable
            v-model="form.paymentDaysBegin"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择账期开始日">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="账期截止日" prop="paymentDaysEnd">
          <el-date-picker clearable
            v-model="form.paymentDaysEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择账期截止日">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预定收款日期" prop="collectionDate">
          <el-date-picker clearable
            v-model="form.collectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择预定收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实际收款日期" prop="realCollectionDate">
          <el-date-picker clearable
            v-model="form.realCollectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择实际收款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="第几期" prop="receiptNumber">
          <el-input v-model="form.receiptNumber" placeholder="请输入第几期" />
        </el-form-item>
        <el-form-item label="线下支付方式" prop="payMethod">
          <el-input v-model="form.payMethod" placeholder="请输入线下支付方式" />
        </el-form-item>
        <el-form-item label="其它支付方式,支付方式为其它的时候，输入" prop="otherPayMethod">
          <el-input v-model="form.otherPayMethod" placeholder="请输入其它支付方式,支付方式为其它的时候，输入" />
        </el-form-item>
        <el-form-item label="支付流水号" prop="payFlowNo">
          <el-input v-model="form.payFlowNo" placeholder="请输入支付流水号" />
        </el-form-item>
        <el-form-item label="账期房租金额" prop="rentalPrice">
          <el-input v-model="form.rentalPrice" placeholder="请输入账期房租金额" />
        </el-form-item>
        <el-form-item label="税费" prop="tax">
          <el-input v-model="form.tax" placeholder="请输入税费" />
        </el-form-item>
        <el-form-item label="操作人" prop="operationUser">
          <el-input v-model="form.operationUser" placeholder="请输入操作人" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="预留字段1" prop="reserve1">
          <el-input v-model="form.reserve1" placeholder="请输入预留字段1" />
        </el-form-item>
        <el-form-item label="预留字段2" prop="reserve2">
          <el-input v-model="form.reserve2" placeholder="请输入预留字段2" />
        </el-form-item>
        <el-form-item label="预留字段3" prop="reserve3">
          <el-input v-model="form.reserve3" placeholder="请输入预留字段3" />
        </el-form-item>
        <el-form-item label="预留字段4" prop="reserve4">
          <el-input v-model="form.reserve4" placeholder="请输入预留字段4" />
        </el-form-item>
        <el-form-item label="预留字段5" prop="reserve5">
          <el-input v-model="form.reserve5" placeholder="请输入预留字段5" />
        </el-form-item>
        <el-form-item label="删除标识,0:未删除，1：删除" prop="delFlg">
          <el-input v-model="form.delFlg" placeholder="请输入删除标识,0:未删除，1：删除" />
        </el-form-item>
        <el-form-item label="创建用户ID" prop="createUserid">
          <el-input v-model="form.createUserid" placeholder="请输入创建用户ID" />
        </el-form-item>
        <el-form-item label="更新用户ID" prop="updateUserid">
          <el-input v-model="form.updateUserid" placeholder="请输入更新用户ID" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/plans/plan";

export default {
  name: "Plan",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 收款计划表格数据
      planList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        receiptOrderNo: null,
        businessId: null,
        contractId: null,
        contractNo: null,
        contractType: null,
        tTerminationId: null,
        premiseId: null,
        premiseName: null,
        roomId: null,
        roomCode: null,
        roomName: null,
        ownerId: null,
        ownerName: null,
        tenantId: null,
        tenantName: null,
        receiptType: null,
        skStatus: null,
        billType: null,
        itemType: null,
        otherItemName: null,
        paymentAmount: null,
        realPaymentAmount: null,
        withReceiptPlanId: null,
        paymentDaysBegin: null,
        paymentDaysEnd: null,
        collectionDate: null,
        realCollectionDate: null,
        receiptNumber: null,
        payMethod: null,
        otherPayMethod: null,
        payFlowNo: null,
        rentalPrice: null,
        tax: null,
        operationUser: null,
        reserve1: null,
        reserve2: null,
        reserve3: null,
        reserve4: null,
        reserve5: null,
        delFlg: null,
        createUserid: null,
        updateUserid: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        receiptOrderNo: [
          { required: true, message: "收款单号不能为空", trigger: "blur" }
        ],
        businessId: [
          { required: true, message: "商户ID不能为空", trigger: "blur" }
        ],
        contractId: [
          { required: true, message: "合同ID不能为空", trigger: "blur" }
        ],
        contractNo: [
          { required: true, message: "合同编号不能为空", trigger: "blur" }
        ],
        contractType: [
          { required: true, message: "合同类型,1：收房合同，2：出房合同不能为空", trigger: "change" }
        ],
        premiseId: [
          { required: true, message: "楼盘ID不能为空", trigger: "blur" }
        ],
        premiseName: [
          { required: true, message: "小区(使用楼盘名)不能为空", trigger: "blur" }
        ],
        delFlg: [
          { required: true, message: "删除标识,0:未删除，1：删除不能为空", trigger: "blur" }
        ],
        createUserid: [
          { required: true, message: "创建用户ID不能为空", trigger: "blur" }
        ],
        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ],
        updateUserid: [
          { required: true, message: "更新用户ID不能为空", trigger: "blur" }
        ],
        updateTime: [
          { required: true, message: "更新时间不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询收款计划列表 */
    getList() {
      this.loading = true;
      listPlan(this.queryParams).then(response => {
        this.planList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        receiptOrderNo: null,
        businessId: null,
        contractId: null,
        contractNo: null,
        contractType: null,
        tTerminationId: null,
        premiseId: null,
        premiseName: null,
        roomId: null,
        roomCode: null,
        roomName: null,
        ownerId: null,
        ownerName: null,
        tenantId: null,
        tenantName: null,
        receiptType: null,
        skStatus: 0,
        billType: null,
        itemType: null,
        otherItemName: null,
        paymentAmount: null,
        realPaymentAmount: null,
        withReceiptPlanId: null,
        paymentDaysBegin: null,
        paymentDaysEnd: null,
        collectionDate: null,
        realCollectionDate: null,
        receiptNumber: null,
        payMethod: null,
        otherPayMethod: null,
        payFlowNo: null,
        rentalPrice: null,
        tax: null,
        operationUser: null,
        remark: null,
        reserve1: null,
        reserve2: null,
        reserve3: null,
        reserve4: null,
        reserve5: null,
        delFlg: null,
        createUserid: null,
        createTime: null,
        updateUserid: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加收款计划";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPlan(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改收款计划";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePlan(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPlan(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除收款计划编号为"' + ids + '"的数据项？').then(function() {
        return delPlan(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('plans/plan/export', {
        ...this.queryParams
      }, `plan_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
